# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=diffutils
pkgver=3.7
pkgrel=1
pkgdesc="Utility programs used for creating patch files"
arch=('i686' 'x86_64')
url="https://www.gnu.org/software/diffutils"
license=('GPL3')
groups=('base-devel')
depends=('sh')
install=diffutils.install
source=(https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.xz{,.sig}
        diffutils-3.7-msys2.patch)
sha256sums=('b3a7a6221c3dc916085f0d205abf6b8e1ba443d4dd965118da364a1dc1cb3a26'
            'SKIP'
            '4242ebd1aeec43a74b965959a45792d696dc452681b75d49d508f1a21e87ee2e')
validpgpkeys=('155D3FC500C834486D1EEA677FD9FCCB000BEEEE')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/diffutils-3.7-msys2.patch

  autoreconf -fi
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}

  # make sure tests are running OK
  sed -i "s/mkdir -m 0700/mkdir /" tests/init.sh

  ./configure --build=${CHOST} \
    --prefix=/usr \
    --without-libiconv-prefix \
    --without-libintl-prefix
  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
